package com.sinothk.special.buyer.popular.store.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sinothk.special.buyer.popular.store.entity.PopularStore;
import com.sinothk.special.buyer.popular.store.service.IPopularStoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

 /**
 * @Description: 热门店铺推荐
 * @Author: Liangyt
 * @Date:   2022-06-17
 * @Version: V1.0
 */
@Api(tags="热门店铺推荐")
@RestController
@RequestMapping("/popular/popularStore")
@Slf4j
public class PopularStoreController extends JeecgController<PopularStore, IPopularStoreService> {
	@Autowired
	private IPopularStoreService popularStoreService;
	
	/**
	 * 分页列表查询
	 *
	 * @param popularStore
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@AutoLog(value = "热门店铺推荐-分页列表查询")
	@ApiOperation(value="热门店铺推荐-分页列表查询", notes="热门店铺推荐-分页列表查询")
	@GetMapping(value = "/list")
	public Result<?> queryPageList(PopularStore popularStore,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		QueryWrapper<PopularStore> queryWrapper = QueryGenerator.initQueryWrapper(popularStore, req.getParameterMap());
		Page<PopularStore> page = new Page<>(pageNo, pageSize);
		IPage<PopularStore> pageList = popularStoreService.page(page, queryWrapper);
		return Result.OK(pageList);
	}
}
